package com.cloudkinto.session;


import com.cloudkinto.common.error.BaseErrorInfoInterface;
import com.cloudkinto.common.error.ErrorEnum;

import java.io.Serializable;

public class UserSessionException extends RuntimeException implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 错误码
     */
    private String errorCode = ErrorEnum.USER_SESSION_ERROR.getResultCode();
    /**
     * 错误信息
     */
    private String errorMsg;

    public UserSessionException() {
        super();
    }

    public UserSessionException(String errorMsg) {
        super(errorMsg);
        this.errorMsg = errorMsg;
    }

    public UserSessionException(BaseErrorInfoInterface errorInfoInterface) {
        super(errorInfoInterface.getResultMsg());
        this.errorCode = errorInfoInterface.getResultCode();
        this.errorMsg = errorInfoInterface.getResultMsg();
    }

    public UserSessionException(BaseErrorInfoInterface errorInfoInterface, Throwable cause) {
        super(errorInfoInterface.getResultMsg(), cause);
        this.errorCode = errorInfoInterface.getResultCode();
        this.errorMsg = errorInfoInterface.getResultMsg();
    }


    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getMessage() {
        return errorMsg;
    }

    @Override
    public Throwable fillInStackTrace() {
        return this;
    }
}
